package com.appsky.drift.adapter;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import com.appsky.drift.api.DLog;
import com.appsky.drift.api.UserInfo;

import android.app.AlertDialog;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

public class NearbyPersonListAdapter extends BaseAdapter {

	private ArrayList<UserInfo> personList = new ArrayList<UserInfo>();
	private Context context;
	
	public NearbyPersonListAdapter(Context context, ArrayList<UserInfo> personList) {
		this.personList = personList;
		this.context = context;
	}
	
	@Override
	public int getCount() {
		return personList.size();
	}

	@Override
	public Object getItem(int position) {
		return personList.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if (convertView == null) {
			convertView = new NearbyPersonListItem(context);
		}
		((NearbyPersonListItem) convertView).show(personList.get(position));
		return convertView;
	}

}
